#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    combo = new QComboBox(this);
    combo->setGeometry(50,50,200,30);

    combo->addItem("Application");
    combo->addItem("Graphics");
    combo->addItem("Database");
    combo->addItem("Network");


    combo->addItem(QIcon("resources/lambda.png"),"Application");
    combo->addItem(QIcon("resources/lambda.png"),"Graphics");


    connect(combo,SIGNAL(currentIndexChanged(int)),this,SLOT(valueChanged()));

}

Widget::~Widget()
{
    delete ui;
}

void Widget::valueChanged(){
    int  current_index = combo->currentIndex();
    qDebug("Current ComboBox index : %d",current_index);
    QString str;
    str = combo->currentText();

    qDebug(str.toStdString().c_str());
    qDebug("Total Items %d",combo->count());
    combo->removeItem(3);

}

